<%@ taglib prefix="c" uri="jakarta.tags.core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <base href="<%=request.getContextPath()%>/">
    <meta charset="UTF-8">
    <title>编辑支付</title>
    <style>
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background-color: #f5f5f5;
            margin: 0;
            padding: 20px;
        }
        .container {
            max-width: 800px;
            margin: 0 auto;
            background-color: white;
            padding: 30px;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        h1 {
            color: #333;
            margin-bottom: 25px;
            padding-bottom: 10px;
            border-bottom: 1px solid #eee;
        }
        .form-group {
            margin-bottom: 20px;
        }
        label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
            color: #555;
        }
        .form-control {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box;
            font-size: 14px;
        }
        select.form-control {
            height: 38px;
        }
        .form-actions {
            margin-top: 30px;
        }
        .btn {
            padding: 8px 16px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 14px;
        }
        .btn-primary {
            background-color: #007bff;
            color: white;
        }
        .btn-default {
            background-color: #6c757d;
            color: white;
            margin-left: 10px;
        }
        .error-message {
            color: #dc3545;
            margin-bottom: 15px;
            padding: 10px;
            background-color: #f8d7da;
            border-radius: 4px;
            border: 1px solid #f5c6cb;
        }
    </style>
</head>
<body>
<div class="container">
    <h1>编辑支付</h1>
    
    <!-- 错误提示 -->
    <c:if test="${not empty error}">
        <div class="error-message">
            ${error}
        </div>
    </c:if>
    
    <form action="pay/modify" method="post">
                <!-- 隐藏域传递支付ID -->
                <input type="hidden" name="payId" value="${pay.payId}"/>
                
                <div class="form-group">
                    <label>订单号：</label>
                    <input type="text" name="orderNo" value="${pay.orderNo}" class="form-control" readonly/>
                </div>
                <div class="form-group">
                    <label>预约信息：</label>
                    <input type="text" value="${pay.appointment.patientName} - ${pay.appointment.visit.department.deptName} - ${pay.appointment.visit.visitDate}" class="form-control" readonly/>
                </div>
                <div class="form-group">
                    <label>支付金额：</label>
                    <input type="number" step="0.01" name="amount" value="${pay.amount}" class="form-control" min="0.01" required>
                </div>
                <div class="form-group">
                    <label>支付方式：</label>
                    <select name="payMethod" class="form-control" required>
                        <option value="微信支付" <c:if test="${pay.payMethod eq '微信支付'}">selected</c:if>>微信支付</option>
                        <option value="支付宝" <c:if test="${pay.payMethod eq '支付宝'}">selected</c:if>>支付宝</option>
                        <option value="银行卡" <c:if test="${pay.payMethod eq '银行卡'}">selected</c:if>>银行卡</option>
                        <option value="现金" <c:if test="${pay.payMethod eq '现金'}">selected</c:if>>现金</option>
                    </select>
                </div>
                <div class="form-group">
                    <label>支付状态：</label>
                    <select name="paystatus" class="form-control" required>
                        <option value="0" <c:if test="${pay.paystatus eq 0}">selected</c:if>>待支付</option>
                        <option value="1" <c:if test="${pay.paystatus eq 1}">selected</c:if>>已支付</option>
                        <option value="2" <c:if test="${pay.paystatus eq 2}">selected</c:if>>已退款</option>
                    </select>
                </div>
                <div class="form-actions">
                    <button type="submit" class="btn btn-primary">保存修改</button>
                    <a href="pay/find" class="btn btn-default">取消</a>
                </div>
            </form>
</div>
</body>
</html>